/************************************************************************
This file is part of Polar4linux
Copyright (C) 2010-2011 Eric jrdn2
Portions Copyright (C) 2007 Matti Juvonen <mpj@iki.fi> (RS400 Tools)
Portions Copyright (C) 2006 Jani Hursti <jani.hursti@hut.fi>,
Portions Copyright (C) 2001-2003 Tom Oliveira e Silva

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
************************************************************************/

#ifndef _RS400_COMM_H
#define _RS400_COMM_H
#include "RS400_parse.h"
#include <string>
#include <sstream>
#include <vector>
#include <iostream>
#include <sstream>

/* Initialise the tty socket */
int RS400_init(char socket[],int timeoutvalue);
int init_session(std::string chaine0,int timeoutvalue);

int RS400_factoryreset();

void RS400_separate();

int RS400_watchmode();

int RS400_sleepmode();

int RS400_get_overview(unsigned char data[]);

int RS400_get_session(char id, unsigned char data[]);

/* Send raw bytes to the device. Return the number of bytes written */
int RS400_sendbytes(const unsigned char query[], int size);

/* Receive raw bytes from the device. Returns the number of bytes read */
int RS400_recvbytes(unsigned char buf[]);

int RS400_close();
void RS400_close_session();

void _setUSER(polarLINUXio_user const &u);
void _getUSER(polarLINUXio_user &u);

void _setPlayer(polarLINUXio_player const &u);
void _getPlayer(polarLINUXio_player &u);

void _setDisplay(polarLINUXio_general_settings const &u);
void _getDisplay(polarLINUXio_general_settings &u);

void _setGeneralSettings(polarLINUXio_general_settings const &u);
void _getGeneralSettings(polarLINUXio_general_settings &u);

void _setDateAndTime(polarLINUXio_general_settings const &u);
void _getDateAndTime(polarLINUXio_general_settings &u);

void _setStats(polarLINUXio_general_settings const &u);
void _getStats(polarLINUXio_general_settings &u);

void _setExos(polarLINUXio_exercises_list const &u);
void _getExos(polarLINUXio_exercises_list &u);

void _setAdvancedExos(polarLINUXio_advanced_exercises_list const &u);
void _getAdvancedExos(polarLINUXio_advanced_exercises_list &u);

void _setTraining(polarLINUXio_advanced_exercises_list const &u);
void _getTraining(polarLINUXio_advanced_exercises_list &u);

int _getNumberOfExercises();

std::string _getHeader(int num);

void _deleteExercise(int SelectedExNumber);
void _deleteAll();
void _setEvent(polarLINUXio_event const &u);
void _getEvent(polarLINUXio_event &u);
//void _deleteEvent();

void setLOGO();

void _setReminders(polarLINUXio_reminders const &u);
void _getReminders(polarLINUXio_reminders &u);

#endif
